cmake_minimum_required(VERSION 3.0.2)
# 添加项目名称声明
project(localization_monitor)

# 查找依赖包
find_package(catkin REQUIRED COMPONENTS
  roscpp
  tf2
  tf2_ros
  nav_msgs
  geometry_msgs
  message_generation
)

# 设置消息文件
add_message_files(
  FILES
  LocalizationStatus.msg
)

# 生成消息
generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
)

# 设置包含目录
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

# 声明catkin包
catkin_package(
  CATKIN_DEPENDS 
  roscpp 
  tf2 
  tf2_ros 
  nav_msgs 
  geometry_msgs 
  message_runtime
)

# 创建可执行文件
add_executable(odom_consistency_monitor src/odom_consistency_monitor.cpp)

# 链接库
target_link_libraries(odom_consistency_monitor ${catkin_LIBRARIES})

# 添加依赖
add_dependencies(odom_consistency_monitor 
  ${catkin_EXPORTED_TARGETS}
  ${PROJECT_NAME}_generate_messages_cpp
)

install(DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

# 安装库和可执行文件
install(TARGETS odom_consistency_monitor 
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)